<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>竞赛账号管理管理</title>
	<meta name="decorator" content="default"/>

	<script type="text/javascript">
		$(document).ready(function() {
			
		});


		$(document).ready(function() {
			$("#btnImport").click(function () {
				$.jBox($("#importBox").html(), {
					title: "批量导入账号", buttons: false
				});
			});
		});



		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }

       function myDetails(id){
		   console.info(id);
		   $.ajax({
			   type: "POST",
			   url: "${ctx}/race/raceUser/listDetails",
			   data: {
				   id:id
			   },
			   success: function (Class) {
				       $("#listDetails").append("<li>" +   "用户名："+  ((Class.loginName == null)?"":Class.loginName) + "</li>");
					   $("#listDetails").append("<li>" +     "姓名："+  ((Class.name == null)?"":Class.name) + "</li>");
				       $("#listDetails").append("<li>" +  "所属团队："+  ((Class.teamId == null)?"":Class.teamId) + "</li>");
				       $("#listDetails").append("<li>" +     "手机："+  ((Class.mobile == null)?"":Class.mobile) + "</li>");
				       $("#listDetails").append("<li>" +     "邮箱："+  ((Class.email == null)?"":Class.email) + "</li>");
				       $("#listDetails").append("<li>" +     "组织："+  ((Class.organization == null)?"":Class.organization) + "</li>");
			   },
			   error:function(){
				   console.info("error");
			   }
		   });
		   $.jBox($("#listDetailsBox").html(), {title:"查看详情", buttons:{"关闭":true}, submit: function(){}});
	   }
	</script>
	<script type="text/template" id="listDetailsBox">
		<div>
			<ul id="listDetails" style="list-style:none">
			</ul>
		</div>
	</script>
</head>
<body>
<div id="importBox" class="hide">
	<form id="importForm" action="${ctx}/race/raceUser/import" method="post" enctype="multipart/form-data"
		  class="form-search" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入，请稍等...');"><br/>
		<input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>
		<input id="btnImportSubmit" class="btn btn-primary" type="submit" value="   确定   "/>
		<a href="${ctx}/race/raceUser/import/template">点此下载导入模板</a>
	</form>
</div>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/race/raceUser/">竞赛账号列表</a></li>
		<shiro:hasPermission name="race:raceUser:edit"><li><a href="${ctx}/race/raceUser/form">添加账号</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="raceUser" action="${ctx}/race/raceUser/" method="post" class="breadcrumb form-search">

		<sys:message content="${message}"/>
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>登录名：</label>
				<form:input path="loginName" htmlEscape="false" maxlength="100" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
            <li><div style="width: 60px; height: 20px"> </div></li>
			<li><input id="btnImport" class="btn btn-primary" type="button" value="导入"/></li>
			<li><div style="width: 20px; height: 20px"> </div></li>
			<li><a href="${ctx}/race/raceUser/export"  class="btn btn-primary">导出</a> </li>
			<li class="clearfix"></li>
		</ul>

	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>登录名</th>
				<th>所属团队</th>
				<shiro:hasPermission name="race:raceUser:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>


		<c:forEach items="${page.list}" var="raceUser">
			<tr>
				<td><a href="${ctx}/race/raceUser/form?id=${raceUser.id}">
					${raceUser.loginName}
				</a></td>
				
				<td>
					${raceUser.teamId}
				</td>
				<shiro:hasPermission name="race:raceUser:edit"><td>
					<a href="javascript:myDetails('${raceUser.id}')" title="详情">详情</a>
    				<a href="${ctx}/race/raceUser/form?id=${raceUser.id}">修改</a>
					<a href="${ctx}/race/raceUser/delete?id=${raceUser.id}" onclick="return confirmx('确认要删除该竞赛账号吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>

	<div class="pagination">${page}</div>


</body>
</html>